package com.openbravo.pos.panels;

import com.openbravo.basic.BasicException;
import com.openbravo.pos.forms.AppLocal;
import com.openbravo.pos.forms.AppView;
import com.openbravo.pos.forms.JPanelView;
import com.openbravo.pos.printer.DeviceDisplay;
import com.openbravo.pos.printer.DeviceFiscalPrinter;
import com.openbravo.pos.printer.DevicePrinter;
import com.openbravo.pos.printer.DeviceTicket;
import java.awt.BorderLayout;
import java.util.List;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;

public class JPanelPrinter extends JPanel
  implements JPanelView
{
  private JPanel jPanel1;
  private JPanel m_jDisplay;
  private JTabbedPane m_jPrinters;

  public JPanelPrinter(AppView paramAppView)
  {
    initComponents();
    if (paramAppView.getDeviceTicket().getDeviceDisplay().getDisplayComponent() != null)
      this.m_jDisplay.add(paramAppView.getDeviceTicket().getDeviceDisplay().getDisplayComponent());
    List localList = paramAppView.getDeviceTicket().getDevicePrinterAll();
    for (int i = 0; i < localList.size(); i++)
    {
      DevicePrinter localDevicePrinter = (DevicePrinter)localList.get(i);
      if (localDevicePrinter.getPrinterComponent() == null)
        continue;
      this.m_jPrinters.add(localDevicePrinter.getPrinterName(), localDevicePrinter.getPrinterComponent());
    }
    DeviceFiscalPrinter localDeviceFiscalPrinter = paramAppView.getDeviceTicket().getFiscalPrinter();
    if (localDeviceFiscalPrinter.getFiscalComponent() != null)
      this.m_jPrinters.add(localDeviceFiscalPrinter.getFiscalName(), localDeviceFiscalPrinter.getFiscalComponent());
  }

  public JComponent getComponent()
  {
    return this;
  }

  public String getTitle()
  {
    return AppLocal.getIntString("Menu.Printer");
  }

  public void activate()
    throws BasicException
  {
  }

  public boolean deactivate()
  {
    return true;
  }

  private void initComponents()
  {
    this.m_jDisplay = new JPanel();
    this.jPanel1 = new JPanel();
    this.m_jPrinters = new JTabbedPane();
    setLayout(new BorderLayout());
    add(this.m_jDisplay, "North");
    this.jPanel1.setLayout(new BorderLayout());
    this.jPanel1.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    this.jPanel1.add(this.m_jPrinters, "Center");
    add(this.jPanel1, "Center");
  }
}

/* Location:           D:\PowerFulPOS-2.30.2\openbravopos.jar
 * Qualified Name:     com.openbravo.pos.panels.JPanelPrinter
 * JD-Core Version:    0.6.0
 */